import React from 'react';
class TodoItem extends React.Component {
  constructor(props){
    super(props);
    this.handleDelete=this.handleDelete.bind(this);
  }
  handleDelete(){
    this.props.delete(this.props.index)
  }
  render() {
    //对象的解构赋值
    const { content }= this.props;
    console.log(this.props)
    console.log(content)
    return (
      <li>
        <span
          dangerouslySetInnerHTML={{__html: content}}
        ></span>
        <button onClick={this.handleDelete}>删除</button>
      </li>
    )
  }
}

export default TodoItem;